package nextoffer.didi;

import java.util.*;

public class third {
   static Map<String, Integer> map = new HashMap<>();
   static Set<String> set = new TreeSet<>();

        public static void main(String[] args) {
            Scanner in  = new Scanner(System.in);
            int n = in.nextInt();
            String[] strings = new String[n];

            for(int i = 0 ; i < n; i++) {
                strings[i] = in.next();
                map.put(strings[i], 1);

            }
            for(int i = 0 ; i < n; i++) {
                for(int j = 0 ; j < n; j++){

                        String s = strings[i] + strings[j];
                    int i1 = s.substring(1, s.length() - 1).indexOf(strings[i]);
                    int i2 = s.substring(1, s.length() - 1).indexOf(strings[j]);
                    if(i1 != -1)set.add(strings[i]) ;
                    if(i2 != -1)set.add(strings[j]) ;
                }
            }
            System.out.println(set.size());
           set.forEach(x -> System.out.println(x));


        }

    public static void check(String S) {

        map.forEach((x, y) -> {
            int i = S.substring(1, S.length() - 1).indexOf(x, 1);
            int j = S.substring(1, S.length() - 1).lastIndexOf(x, S.length() - 2);
            if(i != -1 && j != -1){
                set.add(x);
            }
        });
    }
}
